Class FeatureResponse

Summary

Fully Qualified Name: CodeIgniter\Test\FeatureResponse
Extends: TestCase

Description

Assertions for a response

Methods

Name Description Defined By
__construct() Constructor. FeatureResponse
assertCookie() Asserts that the response has the specified cookie. FeatureResponse
assertCookieExpired() Asserts that a cookie exists and has an expired time. FeatureResponse
assertCookieMissing() Assert the Response does not have the specified cookie set. FeatureResponse
assertDontSee() Asserts that we do not see the specified text. FeatureResponse
assertDontSeeElement() Assert that we do not see an element selected via a CSS selector. FeatureResponse
assertHeader() Asserts that the Response contains a specific header. FeatureResponse
assertHeaderMissing() Asserts the Response headers does not contain the specified header. FeatureResponse
assertJSONExact() Asserts that the JSON exactly matches the passed in data. FeatureResponse
assertJSONFragment() Test that the response contains a matching JSON fragment. FeatureResponse
assertOK() Asserts that the Response is considered OK. FeatureResponse
assertRedirect() Assert that the given response was a redirect. FeatureResponse
assertSee() Assert that the desired text can be found in the result body. FeatureResponse
assertSeeElement() Assert that we see an element selected via a CSS selector. FeatureResponse
assertSeeInField() Assert that we see an input with name/value. FeatureResponse
assertSeeLink() Assert that we see a link with the matching text and/or class. FeatureResponse
assertSessionHas() Asserts that an SESSION key has been set and, optionally, test it's value. FeatureResponse
assertSessionMissing() Asserts the session is missing $key. FeatureResponse
assertStatus() Asserts that the status is a specific value. FeatureResponse
getJSON() Returns the response's body as JSON FeatureResponse
getXML() Returns the response' body as XML FeatureResponse
isOK() Boils down the possible responses into a bolean valid/not-valid response type. FeatureResponse
isRedirect() Returns whether or not the Response was a redirect response FeatureResponse

Method Details

__construct()

Constructor.

Parameter Name Type Description
$response \Response

Returns:

assertCookie()

Asserts that the response has the specified cookie.

Parameter Name Type Description
$key string
$value null
$prefix string|null

Returns:

assertCookieExpired()

Asserts that a cookie exists and has an expired time.

Parameter Name Type Description
$key string
$prefix string

Returns:

assertCookieMissing()

Assert the Response does not have the specified cookie set.

Parameter Name Type Description
$key string

Returns:

assertDontSee()

Asserts that we do not see the specified text.

Parameter Name Type Description
$search string|null
$element string|null

Returns:

assertDontSeeElement()

Assert that we do not see an element selected via a CSS selector.

Parameter Name Type Description
$search string

Returns:

assertHeader()

Asserts that the Response contains a specific header.

Parameter Name Type Description
$key string
$value null

Returns:

assertHeaderMissing()

Asserts the Response headers does not contain the specified header.

Parameter Name Type Description
$key string

Returns:

assertJSONExact()

Asserts that the JSON exactly matches the passed in data.

If the value being passed in is a string, it must be a json_encoded string.

Parameter Name Type Description
$test string|array

Returns:

assertJSONFragment()

Test that the response contains a matching JSON fragment.

Parameter Name Type Description
$fragment array

Returns:

assertOK()

Asserts that the Response is considered OK.

Returns:

assertRedirect()

Assert that the given response was a redirect.

Returns:

assertSee()

Assert that the desired text can be found in the result body.

Parameter Name Type Description
$search string|null
$element string|null

Returns:

assertSeeElement()

Assert that we see an element selected via a CSS selector.

Parameter Name Type Description
$search string

Returns:

assertSeeInField()

Assert that we see an input with name/value.

Parameter Name Type Description
$field string
$value string|null

Returns:

assertSeeLink()

Assert that we see a link with the matching text and/or class.

Parameter Name Type Description
$text string
$details string|null

Returns:

assertSessionHas()

Asserts that an SESSION key has been set and, optionally, test it's value.

Parameter Name Type Description
$key string
$value null

Returns:

assertSessionMissing()

Asserts the session is missing $key.

Parameter Name Type Description
$key string

Returns:

assertStatus()

Asserts that the status is a specific value.

Parameter Name Type Description
$code int

Returns:

getJSON()

Returns the response's body as JSON

Returns: mixed|bool

getXML()

Returns the response' body as XML

Returns: mixed|string

isOK()

Boils down the possible responses into a bolean valid/not-valid response type.

Returns: bool

isRedirect()

Returns whether or not the Response was a redirect response

Returns: bool

Top